/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


$(document).ready(function(){
    
    $('#srchFrm').submit(function(){
        $.ajax({
            type: 'GET',
            url: "./main?action=organization.search&name="+$('#srchInpt').val(),
            cache: false,
            success: function(html){
                $("#searchResults").html(html);
            }
        });
        return false;
    });
		
    $('#srchInpt').keyup(function(){
        $.ajax({
            type: 'GET',
            url: "./main?action=organization.search&name="+$('#srchInpt').val(),
            cache: false,
            success: function(html){
                $("#searchResults").html(html);
            }
        });
//        alert($('#searchResults').find(".dLink").val());
//        $('#searchResults').find('a').each(function(a,obj){
//            alert((obj).val());
//            alert("fasf");
//            obj.attr("href", attr("href")+"&search="+$('#srchInpt').val());
//        })
    }); 
    
    $('.deleteLink').click(function(){
        alert("asfsfa");
        alert("main?action=organization.delete&id="+$('.deleteLink').parent().find('.deleteId').val()+"name="+$('#srchInpt').val());
        window.location("main?action=organization.delete&id="+$('.deleteLink').parent().find('.deleteId').val()+"&name="+$('#srchInpt').val()); 
    });
    
});
